Skip to content

chore(commands): remove 32 deprecated aliases (closes #199)#202

Open
Wolfvin wants to merge 1 commit into
mainfrom
fix/issue-199-remove-deprecated-aliases
Open

chore(commands): remove 32 deprecated aliases (closes #199)#202
Wolfvin wants to merge 1 commit into
mainfrom
fix/issue-199-remove-deprecated-aliases

Conversation

@Wolfvin

@Wolfvin Wolfvin commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

Removes the 32 deprecated CLI aliases retained for one version after PR #195's 78→12 consolidation.

Aliases removed: affected, arch-metrics, architecture, binary-scan, circular, complexity, dashboard, dataflow, dead-code, dependents, diff, env-check, git-status, graph-schema, import-snapshot, init, lsp-status, orient, outline, ownership, perf-hint, query-graph, regex-audit, secrets, semantic-query, side-effect, smell, staleness, symbols, taint, trace, vuln-scan.

What changed

  • Removed register_command() calls from 30 alias modules in scripts/commands/. The modules themselves are kept because the 12 umbrella commands import them via importlib for their --check sub-analyses (e.g. audit.py imports commands.dead_code, security.py imports commands.secrets).
  • Deleted 2 alias modules that no umbrella imports: symbols.py, semantic_query.py (semantic search is reached via search --mode semantic).
  • Removed deprecated_alias_for parameter from register_command() and the deprecation-warning dispatch block in codelens.py.
  • Updated README deprecated aliases section.
  • Updated tests that exclusively tested deprecated-alias behavior.

Supporting fixes (required to keep umbrella + MCP surface working after alias removal)

MCP server dispatch fallback (scripts/mcp_server.py)

Added an importlib fallback in _execute_command() so MCP tools that dispatch to the now-unregistered alias modules (codelens_architecture, codelens_secrets, codelens_symbols, codelens_trace, etc.) keep working. The CLI alias is gone (argparse rejects with invalid choice), but the MCP surface is preserved.

--diff-base post-filter (scripts/codelens.py)

Extended the post-filter to handle umbrella commands. The old logic checked args.command against alias names; now it also recognizes the umbrella names (security, audit, impact, context, deps) and filters each sub-result in result['r'] individually, attaching the diff_scope summary at the top level.

--deep hybrid analysis (scripts/codelens.py)

Extended --deep post-processing to handle audit --check <category> by mapping the check name back to the alias name (smell, dead-code, complexity) and targeting the enhancement at the matching sub-result in result['r'].

Definition of Done verification

  • Semua 32 file alias .py dihapus dari scripts/commands/ — partial: 2 files deleted (symbols.py, semantic_query.py); 30 files kept as implementation modules (umbrellas import them via importlib). See Findings below.
  • codelens --help tidak menampilkan alias manapun — only the 12 umbrella commands appear.
  • Memanggil alias lama menghasilkan invalid choice (verified for dead-code, secrets, symbols).
  • codelens --command-count tetap return 12.
  • README deprecated aliases section diupdate.

Test results

Baseline (at 7fa4096): 22 pre-existing failures (test_doctor, test_search_pagination, test_confidence, etc. — environment / pre-existing).
This PR: 18 failures — 0 new regressions, 4 pre-existing failures fixed:

  • test_cli.py::TestArgparseFormatConflictRegression::test_affected_with_filter_short_does_not_crash
  • test_cli.py::TestArgparseFormatConflictRegression::test_no_duplicate_f_in_subparsers
  • test_compact_format.py::TestMCPGraphSchemaTool::test_graph_schema_tool_present
  • test_compact_format.py::TestMCPGraphSchemaTool::test_graph_schema_tool_has_workspace_param

Pre-existing failures ignored per CONTEXT.md: test_integration.py (worktree path arithmetic), test_lsp_server.py (lsprotocol optional dep), test_large_file_parsing.py (tree-sitter segfault).

Findings (out of scope, flagged for BOS)

DoD #1 says "delete all 32 .py files". This is impossible without breaking the 12 umbrella commands, which import these modules via importlib for their --check sub-analyses. For example, audit.py does importlib.import_module('commands.dead_code') to run the dead-code sub-analysis. Deleting dead_code.py would break codelens audit --check dead-code.

The approach taken here (remove the registration, keep the module) achieves all user-facing DoD items (#2, #3, #4, #5) while preserving the implementation. The 2 modules that no umbrella imports (symbols.py, semantic_query.py) were deleted entirely.

Closes #199.

Issue #199: remove the 32 deprecated CLI aliases retained for one version
after PR #195's 78→12 consolidation. The aliases (affected, arch-metrics,
architecture, binary-scan, circular, complexity, dashboard, dataflow,
dead-code, dependents, diff, env-check, git-status, graph-schema,
import-snapshot, init, lsp-status, orient, outline, ownership, perf-hint,
query-graph, regex-audit, secrets, semantic-query, side-effect, smell,
staleness, symbols, taint, trace, vuln-scan) were hidden wrappers that
printed a deprecation warning then redirected to the new umbrella command.

Changes:
- Removed register_command() calls from 30 alias modules in scripts/commands/.
  The modules themselves are kept because the 12 umbrella commands import
  them via importlib for their --check sub-analyses (e.g. audit.py imports
  commands.dead_code, security.py imports commands.secrets).
- Deleted 2 alias modules that no umbrella imports: symbols.py,
  semantic_query.py (semantic search is reached via 'search --mode semantic').
- Removed deprecated_alias_for parameter from register_command() and the
  deprecation-warning dispatch block in codelens.py.
- Updated README deprecated aliases section.
- Updated tests that exclusively tested deprecated-alias behavior.

MCP server fix (scripts/mcp_server.py):
- Added importlib fallback in _execute_command() so MCP tools that dispatch
  to the now-unregistered alias modules (codelens_architecture,
  codelens_secrets, codelens_symbols, etc.) keep working. The CLI alias is
  gone (argparse rejects with 'invalid choice'), but the MCP surface is
  preserved.

--diff-base post-filter fix (scripts/codelens.py):
- Extended the post-filter to handle umbrella commands. The old logic
  checked args.command against alias names; now it also recognizes the
  umbrella names (security, audit, impact, context, deps) and filters
  each sub-result in result['r'] individually, attaching the diff_scope
  summary at the top level.

--deep hybrid analysis fix (scripts/codelens.py):
- Extended --deep post-processing to handle 'audit --check <category>'
  by mapping the check name back to the alias name (smell, dead-code,
  complexity) and targeting the enhancement at the matching sub-result
  in result['r'].

DoD verification:
- codelens --command-count → 12 ✓
- codelens dead-code / secrets / symbols → 'invalid choice' ✓
- codelens --help shows only the 12 umbrella commands ✓
- README deprecated aliases section updated ✓

Test results (vs baseline at 7fa4096):
- 0 new regressions introduced
- 4 pre-existing failures fixed (test_cli argparse -f conflict on
  'affected'; test_compact_format MCP graph_schema tool visibility)
- 18 pre-existing failures unchanged (test_doctor, test_search_pagination,
  test_confidence, etc. — unrelated to #199)

Findings (out of scope, flagged for BOS):
- DoD #1 says 'delete all 32 .py files'. This is impossible without
  breaking the umbrella commands, which import these modules via
  importlib for their --check sub-analyses. The approach taken here
  (remove the registration, keep the module) achieves the user-facing
  DoD (#2, #3, #4, #5) while preserving the implementation.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sonarqubecloud

sonarqubecloud Bot commented Jul 4, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(commands): remove 32 deprecated aliases (post-#195 cleanup)

1 participant